<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns associative array with detailed info about given date</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.date-parse" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">date_parse</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7)</p><p class="refpurpose"><span class="refname">date_parse</span> &mdash; <span class="dc-title">Returns associative array with detailed info about given date</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.date-parse-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>date_parse</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$date</code></span>
   ) : <span class="type">array</span></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.date-parse-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">date</code></dt>

     <dd>

      <p class="para">
       Date in format accepted by <span class="function"><a href="strtotime.html" class="function">strtotime()</a></span>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.date-parse-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <span class="type"><a href="language.types.array.html" class="type array">array</a></span> with information about the parsed date
   on success 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.date-parse-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   In case the date format has an error, the element &#039;errors&#039; will 
   contains the error messages.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.date-parse-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2705">
    <p><strong>Example #1 A <span class="function"><strong>date_parse()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">date_parse</span><span style="color: #007700">(</span><span style="color: #DD0000">"2006-12-12&nbsp;10:00:00.5"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [year] =&gt; 2006
    [month] =&gt; 12
    [day] =&gt; 12
    [hour] =&gt; 10
    [minute] =&gt; 0
    [second] =&gt; 0
    [fraction] =&gt; 0.5
    [warning_count] =&gt; 0
    [warnings] =&gt; Array()
    [error_count] =&gt; 0
    [errors] =&gt; Array()
    [is_localtime] =&gt; 
)
</pre></div>
    </div>
   </div>
  </p>
  <p class="para">
   <a href="datetime.formats.relative.html" class="link">Relative formats</a> do not
   influence the values parsed from absolute formats, but are parsed into the
   &quot;relative&quot; element.
   <div class="example" id="example-2706">
    <p><strong>Example #2 <span class="function"><strong>date_parse()</strong></span> with relative formats</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">date_parse</span><span style="color: #007700">(</span><span style="color: #DD0000">"2006-12-12&nbsp;10:00:00.5&nbsp;+1&nbsp;week&nbsp;+1&nbsp;hour"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [year] =&gt; 2006
    [month] =&gt; 12
    [day] =&gt; 12
    [hour] =&gt; 10
    [minute] =&gt; 0
    [second] =&gt; 0
    [fraction] =&gt; 0.5
    [warning_count] =&gt; 0
    [warnings] =&gt; Array
        (
        )

    [error_count] =&gt; 0
    [errors] =&gt; Array
        (
        )

    [is_localtime] =&gt;
    [relative] =&gt; Array
        (
            [year] =&gt; 0
            [month] =&gt; 0
            [day] =&gt; 7
            [hour] =&gt; 1
            [minute] =&gt; 0
            [second] =&gt; 0
        )

)</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.date-parse-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="checkdate.html" class="function" rel="rdfs-seeAlso">checkdate()</a> - 验证一个格里高里日期</span></li>
    <li class="member"><span class="function"><a href="getdate.html" class="function" rel="rdfs-seeAlso">getdate()</a> - 取得日期／时间信息</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>